package pearson.automation.forms.note;

import org.openqa.selenium.By;

import framework.BaseForm;
import framework.elements.Button;
import framework.elements.ComboBox;
import framework.elements.Label;

public class ExportNotesForm extends BaseForm {
    
    public enum Format {
        MSWORD("MS Word"), PDF("PDF"), PLAINTEXT("Plain Text");

        private String val;
        Format(String name) {
            val = name;
        }

        public String toString() {
            return val;
        }
    }
    
    private static Label identifier =
        new Label(By.xpath("//h2[text()='Export Course Notes']"),
                "Export Course Notes");
    
    private ComboBox format = new ComboBox(By.id("format"), "Format");
    private Label exportAndKeepNotes =
        new Label(By.id("delete_no"), "Export And Keep Notes");
    private Label exportAndDeleteNotes =
        new Label(By.id("delete_yes"), "Export And Delete Notes");
    private Button export =
        new Button(By.xpath("//input[@value='Export']"), "Export");
        
    public ExportNotesForm() {
        super(identifier.getLocator(), identifier.getName());
    }
 
    public void setFormat(Format selected_format) {
        format.selectByText(selected_format.toString());
    }
    
    public void selectExportAndKeepNotes() {
        exportAndKeepNotes.clickAndWait();
    }
    
    public void selectExportAndDeleteNotes() {
        exportAndDeleteNotes.clickAndWait();
    }
    
    public void clickExport() {
        export.clickAndWait();
    }
   
}
